g05edf

g05edf © Numerical Algorithms Group, 2002.

Purpose

G05EDF Set up reference vector for generating pseudo-random integers, binomial distribution

Synopsis

[r,ifail] = g05edf(n,p<,nr,ifail>)

Description

 
 G05EDF sets up a reference vector for use in G05EYF. Together 
 these routines produce random numbers from the distribution 
 defined by:
 
                n!    i     n-i     
     P(I=i)= --------p (1-p)        if i=0,...,n,
             i!(n-i)!               
 
     P(I=i)=0                       otherwise.
 

Parameters

g05edf

Required Input Arguments:

n                                     integer
p                                     real

Optional Input Arguments:                       <Default>

nr                                    integer  ceil(20*(1+...
                                        ...    sqrt(abs(n*p*(1-p)))))
ifail                                 integer  -1

Output Arguments:

r (nr)                                real
ifail                                 integer